Skip to content

Conversation

@bakebrain
Copy link

Updated coda/mina python client

Description

During the process of developing python monitoring tools for the mina node I realised that some of the queries hardcoded in the minas/coda python client were not update to the latest graphql schema. This included default methods like get_daemon_status or get_sync_status. I have updated all the queries to work with the latest schema to work with my scripts - and in the process I decided to create this pull request - also fixing all the broken tests, update/clean/align doc-strings and overall formats of the files (the default yapf chromium style is also deprecated by now). I have tested all queries with my node currently running latest devnet [DIRTY]8dfa4837f72c9c4d8a4daa3d416d9c852619fbb4.

Open questions

I have a couple questions regarding this though

  • I have removed methods like get_blocks since the needed data is not part of the schema any longer - they are now available via @garethtdavies minaexplorer endpoint. Is this wrapper supposed to support those queries going forward?

TODOS

  • I didn't test any of the async queries like listen_block_confirmations - not 100% sure how to do that at this point tbh
  • do the coda -> mina renaming

I am happy to contribute more to this part - plz let me know what could be a priority or needs attention!

@yourbuddyconner
Copy link
Contributor

This is wonderful! Thanks for doing that @bakebrain. I will poke someone to try and get this merged!

@yourbuddyconner
Copy link
Contributor

Also, I would recommend doing the coda -> mina rename if you have the spare cycles!

@garethtdavies
Copy link
Contributor

get_blocks used the now deprecated blocks query. There is a new bestChain query that is similar for querying the last k blocks on the canonical chain and a block query for a given state hash/height.

@bakebrain
Copy link
Author

@yourbuddyconner refactored "coda" to "mina"
@garethtdavies added 3 new methods: get_best_chain - takes max_length param - I default it to 10 to achieve the "order" - otherwise I will get random(?) 300ish results , get_block_by_height takes height as param and get_block_by_state_hash, takes state_hash as param. The hardcoded queries are not overly pretty - maybe it makes sense to have some query builder here - to better control the return values as well. I guess having a "blank send query" method probably also makes sense since at least you have some control there around the returned fields.

@yourbuddyconner
Copy link
Contributor

Love it, I will do some testing from your branch on the new testnet today. Thanks for putting in the work it is appreciated.

@bakebrain
Copy link
Author

Thx for looking into it - plz let me know what you would like to change! I also have this notebook to play with the client: https://github.com/bakebrain/coda-python-client/blob/mina-play/mina_client_playground.ipynb

@yourbuddyconner
Copy link
Contributor

yourbuddyconner commented Mar 1, 2021

The get_daemon_status command needs to be ammended to include the peer fields:

      peer {
        host
        libp2pPort
        peerId
      }

@bakebrain do you have discord and/or twitter?

@bakebrain bakebrain closed this Mar 1, 2021
@bakebrain bakebrain reopened this Mar 1, 2021
@bakebrain
Copy link
Author

@yourbuddyconner added the peer info!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants